﻿using System;
using System.Collections.Generic;
using System.Text;
using PLM.ConfigurationCenter.Model;
using PLM.Service.CommomItem.Log.Dto;
using SqlSugar;

namespace PLM.ConfigurationCenter.Service {
    /// <summary>
    /// 
    /// </summary>
    public class LogInfoService {
        /// <summary>
        /// 
        /// </summary>
        private ISqlSugarClient _client;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sqlsugarClient"></param>
        public LogInfoService(ISqlSugarClient sqlsugarClient) {
            _client = sqlsugarClient;
            _client.CodeFirst.InitTables<SystemLogModel>();
        }
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="values"></param>
        /// <returns></returns>
        public async Task<int> Insert<T>(List<T> values) where T : class, new() {
            if (values?.Count == 0) {
                return 0;
            }
            int res = await _client.Insertable(values).ExecuteCommandAsync();
            return res;
        }


    }
}
